<script>
	layui.use(['layer','upload'], function(){
        var layer = layui.layer;
        var upload = layui.upload;
        upload.render({
           elem: "{{ $upload_img }}",
			url: "{{ $url }}",
            multiple: true,
            auto:true,
			data:{'_token':$('meta[name="csrf-token"]').attr('content')},
            before: function(obj) {
                layer.msg('图片上传中...', {
                    icon: 16,
                    shade: 0.01,
                    time: 0
                })
            },
            done: function(res) {
				if(res.status == 1){
					layer.close(layer.msg(res.msg,{time:2000,icon:1}));
					$('{{ $upload_img_list }}').append('<dd class="upload-icon-img" ><div class="upload-pre-item"><i onclick="delete_img_all(this)"   class="layui-icon"></i><a class="example-image-link" href="' + res.url+ ' " data-lightbox="example-set" data-title=""><img src="' + res.url + '" class="img" /></a><input type="hidden" name="{{$images}}[]" value="' + res.image_id + '" /></div></dd>');
				}else{
					layer.close(layer.msg(res.msg,{time:2000,icon:2}));
				}
            }
            ,error: function(){
                layer.msg('上传错误！');
            }
        });
		delete_img_all = function (obj){
			$(obj).parent().parent('.upload-icon-img').remove();
		}
    });
</script>